//
//  QuickUIConfig.m
//  UEPersonage
//
//  Created by mac on 2017/9/26.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "QuickUIConfig.h"

@implementation QuickUIConfig

+(UILabel *)createLabelFrame:(CGRect)frame backColor:(UIColor *)backColor text:(NSString *)text textColor:(UIColor *)textColor textFont:(UIFont *)font textAlignment:(NSTextAlignment)textAlignment numberOfLines:(NSInteger)numberOfLines{
    
    UILabel *label = [[UILabel alloc] initWithFrame:frame];
    label.backgroundColor = backColor;
    label.text = text;
    label.font = font;
    label.textAlignment = textAlignment;
    label.textColor = textColor;
    label.numberOfLines = numberOfLines;
    return label;
    
}


+(UIButton *)createBtnFrame:(CGRect)frame buttonType:(UIButtonType)buttonType backColor:(UIColor *)backColor textColor:(UIColor *)textColor title:(NSString *)title textFont:(UIFont *)font textAlignment:(UIControlContentHorizontalAlignment)textAlignment target:(id)target action:(SEL)action{
    
    UIButton *btn = [UIButton buttonWithType:buttonType];
    btn.frame = frame;
    btn.backgroundColor = backColor;
    [btn setTitle:title forState:UIControlStateNormal];
    [btn setTitleColor:textColor forState:UIControlStateNormal];
    btn.titleLabel.font = font;
    btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    return btn;
    
}


+(UIImageView *)createImageViewFrame:(CGRect)frame imagePathType:(UIImageViewPathType)imagePathType imageName:(NSString *)imageName cornerRadius:(CGFloat)cornerRadius masksToBounds:(BOOL)masksToBounds{
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame];
    imageView.backgroundColor = [UIColor whiteColor];
    imageView.layer.cornerRadius = cornerRadius;
    imageView.layer.masksToBounds = masksToBounds;
    switch (imagePathType) {
        case UIImageViewPathTypeLocal:
            imageView.image = [UIImage imageNamed:imageName];
            NSLog(@"imageName == %@",imageName);
            break;
        case UIImageViewPathTypeInter:
            [imageView sd_setImageWithURL:[NSURL URLWithString:shareData.headURL] placeholderImage:[UIImage imageNamed:@"user"]];
            break;
        default:
            break;
    }
    return imageView;
}


+ (UIView *)createViewFrame:(CGRect)frame backColor:(UIColor *)backColor cornerRadius:(CGFloat)cornerRadius masksToBounds:(BOOL)masksToBounds{
    
    UIView *view = [[UIView alloc]initWithFrame:frame];
    view.backgroundColor = backColor;
    view.layer.cornerRadius = cornerRadius;
    view.layer.masksToBounds = masksToBounds;
    return view;
}


@end
